﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Red_Gun
{
    public class Grid : GameFrames.Grid
    {
        public Grid(int w, int h, int tileid)
        {
            left = 0;
            top = 0;
            cellHeight = 32;
            cellWidth = 32;
            gridWidth = w;
            gridHeight = h;
            myCells = new Frame[gridHeight, gridWidth];
            arrangeTiles(tileid);
            //overwriteAllTiles(allTiles);
            //myArray[0] = this;
        }

        protected override void arrangeTiles(int id)
        {
            for (int j = 0; j < gridHeight; j++)
            {
                for (int i = 0; i < gridWidth; i++)
                {
                    myCells[j, i] = new Frame(Spriteset.myArray[id], i, j);
                }
            }
        }

        public override void overwriteSomeTiles(int xStart, int xEnd, int yStart, int yEnd, GameFrames.Frame tile)
        {
            for (int j = yStart; j < yEnd; j++)
            {
                for (int i = xStart; i < xEnd; i++)
                {
                    myCells[j, i] = new Frame(tile.mySpriteset, i, j);
                }
            }
        }

    }
}
